package makabakaquestionnaire.zutsoftware.service.impl;

import makabakaquestionnaire.zutsoftware.entity.ProjectTemplate;
import makabakaquestionnaire.zutsoftware.mapper.ProjectTemplateMapper;
import makabakaquestionnaire.zutsoftware.service.IProjectTemplateService;
import makabakaquestionnaire.zutsoftware.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 评价模板Service业务层处理
 *
 * @author wjf
 * @date 2022-03-23
 */
@Service
public class ProjectTemplateServiceImpl implements IProjectTemplateService
{
    @Autowired
    private ProjectTemplateMapper projectTemplateMapper;

    /**
     * 查询评价模板
     *
     * @param id 评价模板主键
     * @return 评价模板
     */
    @Override
    public ProjectTemplate selectProjectTemplateById(Long id)
    {
        return projectTemplateMapper.selectProjectTemplateById(id);
    }

    @Override
    public ProjectTemplate selectProjectTemplateByKey(String projectKey) {
        return projectTemplateMapper.selectProjectTemplateByKey(projectKey);
    }

    /**
     * 查询评价模板列表
     *
     * @param projectTemplate 评价模板
     * @return 评价模板
     */
    @Override
    public List<ProjectTemplate> selectProjectTemplateList(ProjectTemplate projectTemplate)
    {
        return projectTemplateMapper.selectProjectTemplateList(projectTemplate);
    }

    /**
     * 新增评价模板
     *
     * @param projectTemplate 评价模板
     * @return 结果
     */
    @Override
    public int insertProjectTemplate(ProjectTemplate projectTemplate)
    {
        projectTemplate.setCreateTime(DateUtils.getNowDate());
        return projectTemplateMapper.insertProjectTemplate(projectTemplate);
    }

    /**
     * 修改评价模板
     *
     * @param projectTemplate 评价模板
     * @return 结果
     */
    @Override
    public int updateProjectTemplate(ProjectTemplate projectTemplate)
    {
        projectTemplate.setUpdateTime(DateUtils.getNowDate());
        return projectTemplateMapper.updateProjectTemplate(projectTemplate);
    }

    /**
     * 批量删除评价模板
     *
     * @param ids 需要删除的评价模板主键
     * @return 结果
     */
    @Override
    public int deleteProjectTemplateByIds(Long[] ids)
    {
        return projectTemplateMapper.deleteProjectTemplateByIds(ids);
    }

    /**
     * 删除评价模板信息
     *
     * @param id 评价模板主键
     * @return 结果
     */
    @Override
    public int deleteProjectTemplateById(Long id)
    {
        return projectTemplateMapper.deleteProjectTemplateById(id);
    }
}
